
-----------------------------------------------------------------------
-----------------------------------------------------------------------
-- 日程安排
----------------------------------------------------------------------- 
----------------------------------------------------------------------- 
DROP TABLE h_dc_events;
CREATE TABLE h_dc_events (
  id	 		int 			NOT NULL,
  userid		int				NOT NULL,
  event_id 		int 			NOT NULL,
  start_date 	date	 		NOT NULL,
  end_date 		date 			NOT NULL,
  details 		varchar2(2000) 	NOT NULL,
  PRIMARY KEY (id)
);
-- 序列
create sequence h_dc_events_seq start with 1 increment by 1;
-- h_dc_events.id自动赋值
create or replace trigger h_dc_events_id_auto
  before insert on h_dc_events
  for each row
begin
  select h_dc_events_seq.nextval into :new.id from dual;
end;
/

create index h_dc_events_u_e on h_dc_events(userid,event_id);